<template>
<h3>内联事件处理器</h3>
<button v-on:click="count1++">加</button>
<p>{{count1}}</p>

<h3>方法事件处理器</h3>
<button @:click="addCount">加</button>
<p>{{count2}}</p>

<!-- v-on缩写为@，绑定事件处理器，可以传参，如果想传event，就加$ -->
<h3>传递参数</h3>
<p v-for="(item, index) in names" :key=index @click="getNameHandle(item, $event)">{{item}}</p>
</template>

<script>
    export default{
        data(){
            return{
                count1:0,
                count2:0,
                names:["123", "456", "789"]
            }
        },
        methods:{
            addCount(){
                this.count2++
            },
            getNameHandle(name, e){
                console.log(name, e)
            }

        }
    }
</script>